package com.lb.shopguide.manager.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.lb.shopguide.ui.view.toast.ToastBossNoNet;

/**
 * Created by kang on 2018/3/12.
 */

public class NetworkChangeReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
        if (networkInfo != null && networkInfo.isAvailable()) {
//            Toast.makeText(context, "网络打开", Toast.LENGTH_SHORT).show();
        } else {
            ToastBossNoNet.getToastBossNoNet(context).toastShow(context);
        }
    }
}
